package com.entity.message;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("message") // 映射到数据库表名
@ApiModel("用户消息实体类")
public class Message {

    @ApiModelProperty(value = "主键，唯一标识每条消息")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "消息标题，不能为空")
    @TableField("title")
    private String title;

    @ApiModelProperty(value = "消息内容，详细描述，不能为空")
    @TableField("content")
    private String content;

    @ApiModelProperty(value = "消息类型: ")
    @TableField("message_type")
    private String messageType;

    @ApiModelProperty(value = "消息接收人角色ID，可为空")
    @TableField("role_id")
    private Long roleId;

    @ApiModelProperty(value = "消息接收人角色名称，冗余字段便于展示")
    @TableField("role_name")
    private String roleName;

    @ApiModelProperty(value = "接收人用户ID，决定谁能看到这条消息")
    @TableField("receiver_id")
    private Long receiverId;

    @ApiModelProperty(value = "消息状态: UNREAD未读, READ已读, AGREE同意, REFUSE拒绝")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "处理完成时间，审批类消息使用")
    @TableField("processed_time")
    private LocalDateTime processedTime;

    @ApiModelProperty(value = "业务类型: AFTER_SALES, ORDER, LEAVE, APPROVAL")
    @TableField("business_type")
    private String businessType;

    @ApiModelProperty(value = "售后单编号，用于快速关联查询")
    @TableField("order_number")
    private String orderNumber;

    @ApiModelProperty(value = "关联服务问题ID")
    @TableField("service_problem_id")
    private Long serviceProblemId;

    @ApiModelProperty(value = "发送人name，系统发送为0")
    @TableField("sender_name")
    private String senderName;

    @ApiModelProperty(value = "消息来源: SYSTEM, USER, AUTO")
    @TableField("source")
    private String source;

    @ApiModelProperty(value = "创建时间，默认当前时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间，自动更新")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "通过状态")
    @TableField("pass_status")
    private Integer passStatus;

    @ApiModelProperty(value = "关联人ID，用于关联订单的出行人员")
    @TableField("related_id")
    private Long relatedId;

    @ApiModelProperty(value = "处理人")
    @TableField("handlers")
    private String handlers;

}